package com.my.cd.factory.simpleFactory;

import com.my.cd.factory.pizza.CheesePizza;
import com.my.cd.factory.pizza.GreekPizza;
import com.my.cd.factory.pizza.PepperPizza;
import com.my.cd.factory.pizza.Pizza;

/**
 * 简单工厂类
 */
public class SimplePizzaFactory {

    public Pizza CreatePizza(String orderType) {
        Pizza pizza = null;
        switch (orderType) {
            case "cheese":
                pizza = new CheesePizza();
                break;
            case "greek":
                pizza = new GreekPizza();
                break;
            case "pepper":
                pizza = new PepperPizza();
                break;
        }
        return pizza;
    }

}
